{% extends 'base.html' %}

{% block title %}个人资料 - 请假审批系统{% endblock %}

{% block content %}
<div class="card">
    <div class="card-header">
        <h2>个人资料</h2>
    </div>
    
    <form method="post">
        {% csrf_token %}
        
        <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;">
            <div>
                <h3 style="margin-bottom: 1rem; color: #333;">基本信息</h3>
                
                <div class="form-group">
                    <label for="{{ user_form.first_name.id_for_label }}">姓名</label>
                    {{ user_form.first_name }}
                </div>
                
                <div class="form-group">
                    <label for="{{ user_form.last_name.id_for_label }}">姓氏</label>
                    {{ user_form.last_name }}
                </div>
                
                <div class="form-group">
                    <label for="{{ user_form.email.id_for_label }}">邮箱</label>
                    {{ user_form.email }}
                </div>
            </div>
            
            <div>
                <h3 style="margin-bottom: 1rem; color: #333;">工作信息</h3>
                
                <div class="form-group">
                    <label for="{{ profile_form.employee_id.id_for_label }}">工号</label>
                    {{ profile_form.employee_id }}
                </div>
                
                <div class="form-group">
                    <label for="{{ profile_form.department.id_for_label }}">部门</label>
                    {{ profile_form.department }}
                </div>
                
                <div class="form-group">
                    <label for="{{ profile_form.position.id_for_label }}">职位</label>
                    {{ profile_form.position }}
                </div>
                
                <div class="form-group">
                    <label for="{{ profile_form.phone.id_for_label }}">电话</label>
                    {{ profile_form.phone }}
                </div>
                
                <div class="form-group">
                    <label for="{{ profile_form.hire_date.id_for_label }}">入职日期</label>
                    {{ profile_form.hire_date }}
                </div>
            </div>
        </div>
        
        <div style="border-top: 1px solid #eee; padding-top: 1.5rem; margin-top: 1.5rem; text-align: center;">
            <button type="submit" class="btn btn-primary">保存修改</button>
            <a href="{% url 'dashboard' %}" class="btn btn-secondary">取消</a>
        </div>
    </form>
</div>

<div class="card">
    <div class="card-header">
        <h2>请假统计</h2>
    </div>
    
    <div class="stats-grid">
        <div class="stat-card">
            <div class="stat-number">{{ user.userprofile.annual_leave_days }}</div>
            <div class="stat-label">年假总天数</div>
        </div>
        <div class="stat-card">
            <div class="stat-number">{{ user.userprofile.used_leave_days }}</div>
            <div class="stat-label">已用年假天数</div>
        </div>
        <div class="stat-card">
            <div class="stat-number">{{ user.userprofile.remaining_leave_days }}</div>
            <div class="stat-label">剩余年假天数</div>
        </div>
        <div class="stat-card">
            <div class="stat-number">{{ leave_summary.total_applications }}</div>
            <div class="stat-label">今年总申请数</div>
        </div>
    </div>
</div>
{% endblock %}
